home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / demos / lmitool / sylvester.sci < prev    next >
Text File  |  1999-09-16  |  1KB  |  36 lines

  1.  function [X]=sylvester(A,B,C,flag)
  2.  // Generated by lmitool on Thu Feb 09 11:55:34 MET 1995
  3.    
  4.    Mbound = 1e3;
  5.    abstol = 1e-10;
  6.    nu = 10;
  7.    maxiters = 100;
  8.    reltol = 1e-10;
  9.    options=[Mbound,abstol,nu,maxiters,reltol];
  10.     
  11.  ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
  12.  [na,ma]=size(A);[nb,mb]=size(B)                                   
  13.  if ma<>na|mb<>nb then error("invalid dimensions");end             
  14.  X_init=zeros(ma,nb)                                               
  15.  /////////// 
  16.   
  17.  XLIST0=list(X_init)
  18.  XLIST=lmisolver(XLIST0,sylvester_eval,options)
  19.  [X]=XLIST(:)
  20.   
  21.   
  22.   
  23.  /////////////////EVALUATION FUNCTION////////////////////////////
  24.   
  25.  function [LME,LMI,OBJ]=sylvester_eval(XLIST)
  26.  [X]=XLIST(:)
  27.   
  28.  /////////////////DEFINE LME, LMI and OBJ BELOW
  29.  if flag=='c' then LME=A*X+X*B-C                                   
  30.  else LME=A*X*B-C                                                  
  31.  end                                                               
  32.  LMI=[]                                                            
  33.  OBJ=[]                                                            
  34.                                                                    
  35.                                                                    
  36.